﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLayer;
using BusinessObject;

namespace RestHouseReservation
{
    public partial class UpdateUser : System.Web.UI.Page
    {
        public UserDao user = new UserDao();
        UsersLogic Logic = new UsersLogic();
        static string PaNumber = "";
        public bool PaResult = false;
        static public bool Flag = false;
        static public bool Flag2 = true;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            PaNumber = TextBox7.Text;
            PaResult = Logic.PACheck(PaNumber);
            if (PaResult==false)
            {
                Flag = true;
                Flag2 = false;  
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            user.Status = DropDownList2.SelectedValue;
            user.Rank = DropDownList1.SelectedValue;
            user.Email = TextBox3.Text;
            user.Phone = TextBox4.Text;
            user.Password = TextBox5.Text;
            Logic.UpdateUser(user,PaNumber);
            Flag = false;
            Flag2 = true;
        }
    }
}